<?php
/**
 * FastApp.
 * 10/17/24
 * @Author 深色的海 (wx:deepsea_0024)
 * @Contact telegram:deepsea159 
 */

namespace App\Fastapp\Api\Controller\Comm;

use App\Fastapp\Api\Controller\ApiController;
use App\Fastapp\Api\Service\Comm\MessageService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\GetMapping;
use Psr\Http\Message\ResponseInterface;

#[Controller('api/sys/message')]
class MessageController extends ApiController
{
    #[Inject]
    public MessageService $service;

    #[GetMapping]
    public function type(): ResponseInterface
    {
        return $this->success($this->service->type());
    }

    #[GetMapping]
    public function list(): ResponseInterface
    {
        return $this->success($this->service->list((int)$this->request->header('account-type'), (int)$this->request->input('type')));
    }

    #[GetMapping('detail')]
    public function detail(): ResponseInterface
    {
        return $this->success($this->service->detail((int)$this->request->input('id')));
    }
}